﻿<Window x:Class="NewModelDemo.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:MapControlDemo"
        xmlns:smx="clr-namespace:SharpMap.Wpf.Markup;assembly=SharpMap.Wpf.Markup"
    xmlns:wpfshmp="clr-namespace:SharpMap.Wpf;assembly=SharpMap.Wpf"
    xmlns:pres="clr-namespace:SharpMap.Presentation.Wpf;assembly=SharpMap.Presentation.Wpf"
    xmlns:shmpstl="clr-namespace:SharpMap.Styles;assembly=SharpMap"
    xmlns:thm="clr-namespace:SharpMap.Wpf.Thematics;assembly=SharpMap.Wpf"
    xmlns:bl="clr-namespace:BuisnessData;assembly=BuisnessData"
    Title="Window1" Height="350" Width="500"
    Loaded="Window_Loaded">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/Images.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <thm:CitiesTheme x:Key="citiesTheme"/>
        <DataTemplate DataType="{x:Type bl:Car}">
                <Image Source="{StaticResource CarImageKey}"
                Height="32" Width="32" 
                       />
        </DataTemplate>
        </ResourceDictionary>
    </Window.Resources>
    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="_File"/>
            <MenuItem Header="_Tools">
                <MenuItem Header="ShowMyObjects!" Click="MenuItem_Click_1"/>
                          <MenuItem Header="Te_st" Click="MenuItem_Click"/>
            </MenuItem>
        </Menu>
        
        <wpfshmp:MapToolBar TargetView="{Binding ElementName=_mapControl}" DockPanel.Dock="Top"/>
        
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="6*"/>
            </Grid.ColumnDefinitions>

            <ListView Grid.Column="0" x:Name="_listView" ItemsSource="{Binding}">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBox Text="{Binding Location, Converter={x:Static local:LocationToPointConverter.Instance}}" />
                        </StackPanel>
                    </DataTemplate>
                </ListView.ItemTemplate>
                
            </ListView>
            <GridSplitter Grid.Column="0" Width="4" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>
        
        <wpfshmp:MapControl Background="Blue" x:Name="_mapControl" Theme="{StaticResource citiesTheme}" Grid.Column="1">
            <wpfshmp:MapLayer 
                Source="..\..\..\TestData\world_adm0.shp">
                <wpfshmp:MapLayer.LayerStyle>
                    <shmpstl:VectorStyle Fill="{smx:StyleColor Gray}" 
                                         Outline="{smx:StylePen Color='{smx:StyleColor Yellow}', Width=0.3}"/>
                </wpfshmp:MapLayer.LayerStyle>
            </wpfshmp:MapLayer>

            <wpfshmp:MapLayer Source="..\..\..\TestData\cities.shp"/>
            
            <wpfshmp:MapLayer x:Name="_contentLayer">
                    
                    <Line X1="20" Y1="20" X2="30" Y2="30" StrokeThickness="0.1" Stroke="Black"/>
                    <RadioButton wpfshmp:GeoPanel.WorldX="25" wpfshmp:GeoPanel.WorldY="25"/>
                    
                    <Path x:Name="_path"  Opacity="0.7">
                    <Path.Data>
                        <PathGeometry>
                            <PathGeometry.Figures>
                                <PathFigure StartPoint="24,24" IsClosed="True">
                                    <LineSegment Point="29,20"/>
                                    <ArcSegment Size="5,5" Point="29,28" SweepDirection="Clockwise" IsLargeArc="False"/>
                                </PathFigure>
                            </PathGeometry.Figures>
                        </PathGeometry>
                    </Path.Data>
                        <Path.Style>
                            <Style>
                                <Style.Triggers>
                                    <Trigger Property="Path.IsMouseOver" Value="True">
                                        <Setter Property="Path.Fill" Value="Red"/>
                                    </Trigger>
                                </Style.Triggers>
                                <Setter Property="Path.Fill" Value="Blue"/>
                            </Style>
                        </Path.Style>
                    </Path>
             </wpfshmp:MapLayer>
         </wpfshmp:MapControl>
        </Grid>
    </DockPanel>
</Window>
